#include <iostream>
#include <string>
#include <memory>
#include <jsoncpp/json/json.h>

int main()
{
  std::string str = R"({"姓名" : "小黑", "年龄" : 18, "成绩":[15.5, 16, 18.5]})";
  Json::Value root;
  Json::CharReaderBuilder crb;
  std::unique_ptr<Json::CharReader> ptr(crb.newCharReader());
  std::string errs;
  bool ret = ptr->parse(str.c_str(), str.c_str() + str.size(), &root, &errs);
  if(ret == false)
  {
    std::cout << "parse error!  errs : " << errs << std::endl;  
  }
  std::cout << root["姓名"].asString() << std::endl;
  std::cout << root["年龄"].asString() << std::endl;
  int sz = root["成绩"].size();
  for(int i = 0; i < sz; i++)
  {
    std::cout << root["成绩"][i] << std::endl;
  }
  return 0;
}
